package com.jianneng.jdg.model.adapter;

import java.util.ArrayList;
import java.util.List;
import java.util.zip.Inflater;

import com.example.com.jianneng.jdg.R;
import com.jianneng.jdg.model.user.WagesInfo;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class ReportMoneyListViewAdapter extends BaseAdapter {
	
	private LayoutInflater mInflater=null;
	private List<WagesInfo> list=new ArrayList<WagesInfo>();
	public ReportMoneyListViewAdapter(Context context,List<WagesInfo> list){
		
		this.mInflater=LayoutInflater.from(context);
		this.list=list;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return list.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return list.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View view=null;
		ViewHolder viewHolder=null;
		if (convertView==null) {
			viewHolder=new ViewHolder();
			convertView=mInflater.inflate(R.layout.reportmoney_listview, null);
			viewHolder.id = (TextView) view.findViewById(R.id.reportmoney_listview_id);
			viewHolder.name=(TextView) view.findViewById(R.id.reportmoney_listview_name);
			viewHolder.ungetmoney=(TextView) view.findViewById(R.id.reportmoney_listview_ungetmoney);
			viewHolder.getmoney=(TextView) view.findViewById(R.id.reportmoney_listview_getmoney);
			
		}else {
			view=convertView;
			viewHolder=(ViewHolder) view.getTag();
		}
		
		
		return view;
	}
	
	private static class ViewHolder{
	    TextView id;
		TextView name;
		TextView ungetmoney;
		TextView  getmoney;
		
	}
}
